package com.ldw.demo.service;

import com.ldw.demo.dao.ProviderMapper;
import com.ldw.demo.pojo.Provider;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class ProviderServiceImpl implements ProviderService {
    private ProviderMapper providerMapper;

    public void setProviderMapper(ProviderMapper providerMapper) {
        this.providerMapper = providerMapper;
    }

    @Override
    public List<Provider> queryProvider(String queryProCode, String queryProName) {
        HashMap map = new HashMap();
        map.put("queryProCode", queryProCode);
        map.put("queryProName", queryProName);
        List<Provider> providerList = providerMapper.queryProvider(map);
        return providerList;
    }

    @Override
    public Boolean addProvider(Map map) {
        int i = providerMapper.addProvider(map);
        if (i > 0) {
            return true;
        }
        return false;
    }

    @Override
    public Provider queryProviderById(int id) {
        Provider provider = providerMapper.queryProviderById(id);
        return provider;
    }

    @Override
    public Boolean updateProvider(Map map) {
        int i = providerMapper.updateProvider(map);
        if (i > 0) {
            return true;
        }
        return false;
    }

    @Override
    public Boolean deleteProvider(int id) {
        int i = providerMapper.deleteProvider(id);
        if (i > 0) {
            return true;
        }
        return false;
    }
}
